package com.bw.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.config.Result;
import com.bw.domain.TraceTransport;
import com.bw.service.TraceTransportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Big-Hang
 * @data 2023/8/24
 */
@RequestMapping("material")
@RestController
public class MaterialController {

    @Autowired
    TraceTransportService traceTransportService;

        @RequestMapping("materialList")
        public Result materialList(Page page){
            Page page1 = traceTransportService.page(page);
            return Result.ok(page1);
        }


        @RequestMapping("outHouse")
        public Result outHouse(Integer id){
            QueryWrapper<TraceTransport> wrapper = new QueryWrapper<>();
            wrapper.eq("id",id);
            TraceTransport one = traceTransportService.getOne(wrapper);

            one.setOutFactoryStatus(1);
            traceTransportService.updateById(one);

            return Result.ok();
        }




}
